package com.mt.mtyx.common.utils.generate.generate.config;

import com.google.common.base.CaseFormat;
import java.util.HashMap;
import java.util.Map;

/**
 * @author WMT
 * @Date 2023/5/26 17:27
 */
public class PackingCodeConfig {


    /**
     * 公共包名
     */
    private String basePackage;

    /**
     * 实例
     */
    private String entity = "entity";

    /**
     * mapper
     */
    private String mapper = "mapper";

    /**
     * mapperXml
     */
    private String mapperXml = "mapper";

    /**
     * service
     */
    private String service = "service";

    /**
     * serviceImpl
     */
    private String serviceImpl = "service.impl";

    /**
     * controller
     */
    private String controller = "controller";

    /**
     * 分隔符策略
     */
    private CaseFormat separator = CaseFormat.UPPER_UNDERSCORE;

    /**
     * 驼峰策略
     */
    private CaseFormat format = CaseFormat.UPPER_CAMEL;

    /**
     * 前缀名称转换
     */
    private Map<String, String> tablePrefixConvert;

    /**
     * 后缀名称转换
     */
    private Map<String, String> tableSuffixConvert;

    public String getBasePackage() {
        return basePackage;
    }

    public PackingCodeConfig basePackage(String basePackage) {
        this.basePackage = basePackage;
        return this;
    }

    public String getEntity() {
        return entity;
    }

    public PackingCodeConfig entity(String entity) {
        this.entity = entity;
        return this;
    }

    public String getMapper() {
        return mapper;
    }

    public PackingCodeConfig mapper(String mapper) {
        this.mapper = mapper;
        return this;
    }

    public String getMapperXml() {
        return mapperXml;
    }

    public CaseFormat getSeparator() {
        return separator;
    }

    public CaseFormat getFormat() {
        return format;
    }

    public Map<String, String> getTablePrefixConvert() {
        return tablePrefixConvert;
    }

    public Map<String, String> getTableSuffixConvert() {
        return tableSuffixConvert;
    }

    public PackingCodeConfig tablePrefixConvert(Map<String, String> tableConvert) {
        if (this.tablePrefixConvert == null) tablePrefixConvert = new HashMap<>();
        this.tablePrefixConvert.putAll(tableConvert);
        return this;
    }

    public PackingCodeConfig tableSuffixConvert(Map<String, String> tableConvert) {
        if (this.tableSuffixConvert == null) tableSuffixConvert = new HashMap<>();
        this.tableSuffixConvert.putAll(tableConvert);
        return this;
    }

    public PackingCodeConfig mapperXml(String mapperXml) {
        this.mapperXml = mapperXml;
        return this;
    }

    public String getService() {
        return service;
    }

    public PackingCodeConfig service(String service) {
        this.service = service;
        return this;
    }

    public String getServiceImpl() {
        return serviceImpl;
    }

    public PackingCodeConfig serviceImpl(String serviceImpl) {
        this.serviceImpl = serviceImpl;
        return this;
    }

    public String getController() {
        return controller;
    }

    public PackingCodeConfig controller(String controller) {
        this.controller = controller;
        return this;
    }

    public PackingCodeConfig separator(CaseFormat separator) {
        this.separator = separator;
        return this;
    }

    public PackingCodeConfig format(CaseFormat format) {
        this.format = format;
        return this;
    }
}
